package com.gitee.feizns.explore.data_structure.array_and_string.only_char;

/**
 * @author feizns
 * @since 2019/10/25
 */
public class Main {

    public static int firstUniqueChar(String s) {
        if ( s != null ) {
            for (int i = 0; i < s.length(); i++) {
                char item = s.charAt(i);
                int index = -1;
                if ( (index = s.indexOf(item)) != -1
                        && s.indexOf(item, index + 1) == -1 )
                    return i;
            }
        }
        return -1;
    }

}
